<template>
	<view class="">
		<view class="u-error-bg padding-20 u-flex u-flex-items-center">
			<u-avatar
				:text="userInfo.FAname"
				fontSize="24"
				size="60"
				randomBgColor>
			</u-avatar>
			<view class="ml-20 lh-40 u-success-light">
				<view class="">{{userInfo.FUserName}}</view>
				<view class="">{{userInfo.FUserNumber}}</view>
			</view>
		</view>
		<view class="plr-20">
			<view class="home-cell ptb-40 u-cb-white-bg">
				<u-grid>
					<u-grid-item
						v-for="(baseListItem,baseListIndex) in baseList"
						:key="baseListIndex"
						@click="$u.route(baseListItem.url)">
						<view
							class="t-icon"
							:class="baseListItem.icon">
						</view>
						<text class="grid-text mt-10">{{baseListItem.title}}</text>
					</u-grid-item>
				</u-grid>
			</view>
			<view class="home-cell padding-20 u-cb-white-bg u-flex u-flex-between">
				<view class="u-flex u-flex-items-center u-flex-shrink-0">
					<view class="t-icon t-icon-jiaofei" />
					<text class="ml-10">向客户收款</text>
				</view>
				<view class="width-248">
					<u-button 
						text="新增收款"
						type="error"
						shape="circle"
						icon="plus-circle"
						color="linear-gradient(to right, rgb(245,108,108 ), rgb(221,97,97))"
						@click="$u.route('/packgeA/corebusiness/collection')"/>
				</view>
			</view>
			<view class="home-cell padding-20 u-cb-white-bg">
				<view class="fsize-32 pb-20">最近交易记录</view>
				<view id="cell-list">
					<u-list :height="cellHeight" @scrolltolower="onScrollToLower">
						<u-list-item v-for="(im, ix) in cellList" :key="im.FBillNo" @click="$u.route(im.url)">
							<u-cell
								:title="im.FName+'('+im.FRemark + ')'"
								:value="'￥'+ im.FAmount"
								:label="im.FDate"
								center
								customStyle="customstyle">
							</u-cell>
						</u-list-item>
					</u-list>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import getCellHeight from "@/mixins/setCellHeight.js"
	import getCellData from "@/mixins/scrollMixins.js"
	export default{
		mixins:[getCellHeight, getCellData],
		data(){
			return {
				userInfo:{},
				type: 0,
				data_type: 0,
				loadUrl: '/RptRechargeRecord',
				baseList:[
					{title:'我的资料', icon:'t-icon-shenqing', id: 'b01', url:'/packgeA/user/business-info'},
					{title:'交易明细', icon:'t-icon-shujutongji', id: 'b02', url:'/packgeA/data-list/transaction-detailed'},
					{title:'交易统计', icon:'t-icon-yinhangka', id: 'b03', url:'/packgeA/data-list/statistics-detailed'}
				],
				customstyle:{
					padding: "20px 0"
				},
				pageSize: 8,
			}
		},
		onLoad(){
			// #ifdef MP-WEIXIN
			if(wx.hideHomeButton){  
				wx.hideHomeButton();  
			}
			// #endif
			 this.userInfo = uni.getStorageSync('userInfo')
			if(this.userInfo.FUserName){
				this.userInfo.FAname = this.userInfo.FUserName.substring(0, 1)
			}
			// if(this.userInfo.FLoginType != 1){
			// 	uni.reLaunch({
			// 		url: '/pages/home/index-member'
			// 	})
			// }
		},
		onShow(){
			this.getData(this.loadUrl,this.pageIndex, this.pageSize, this.type, this.data_type)
		},
	}
</script>

<style scoped lang="scss">
	.home-cell{
		border-radius: 12upx;
		margin-top: 20upx;
	}
	::v-deep .u-cell__body.data-v-1c4434ae{
		padding: 20upx 0;
	}
</style>